.SUFFIXES : .ml .mli .cmx .cmi .mly .mll .cmo

MLFILES         = lns.ml insertion.ml planning.ml planner.ml
CMXFILES        = $(MLFILES:.ml=.cmx)
CMOFILES        = $(CMXFILES:.cmx=.cmo)

CAMLOPT         = ocamlopt -inline 100
CAML            = ocamlc -g
CAMLYACC        = ocamlyacc
CAMLLEX         = ocamllex

LIBS		= -I ../Libs
CMXLIB		= utils.cmx uav_data.cmx
CMOLIB		= $(CMXLIB:.cmx=.cmo)

all: planner.out

planner.out: $(CMXFILES)
	@echo OL $(CMXFILES) to $@
	@$(CAMLOPT) $(LIBS) graphics.cmxa $(CMXLIB) $(CMXFILES) -o $@

pso.out: data.cmx utils.cmx insertion.cmx swarm.cmx pso.cmx
	@echo OL data.cmx utils.cmx insertion.cmx swarm.cmx pso.cmx to $@
	@$(CAMLOPT) $(LIBS) $(CMXLIB) graphics.cmxa insertion.cmx swarm.cmx pso.cmx -o $@

.ml.cmo:
	@echo OC $<
	@$(CAML) $(LIBS) -c $<

.ml.cmx :
	@echo OC $<
	@$(CAMLOPT) $(LIBS) -c $<

.mli.cmi :
	@echo OC $<
	@$(CAMLOPT) $(LIBS) -c $<

clean :
	@echo CLEAN
	@rm -f *.cm* \#*\# *.o *~  *.opt *.out .depend

.depend:
	ocamldep -native *.mli *.ml >.depend
include .depend
